package two.to.calculators;

public class CycleDivisionCalculator {
    /*
     * private final Graph graph;
     * 
     * private List<Point> cycle;
     * 
     * private Set<Point> unused;
     * 
     * private int startIndex;
     * 
     * public CycleDivisionCalculator(Graph graph, int startIndex) { this.graph = graph; this.cycle = new
     * ArrayList<Point>(); this.unused = new HashSet<Point>(graph); // this.totalDistance = 0; this.startIndex
     * = startIndex;
     * 
     * }
     * 
     * public TSPSolution compute() { return this.compute(graph.size() / 2); }
     * 
     * public TSPSolution compute(int cycleLength) {
     * 
     * if (cycle.size() == 0) { Point currentPoint = graph.getPoint(startIndex);
     * 
     * cycle.add(currentPoint); unused.remove(currentPoint); currentPoint.setNext(currentPoint); } int counter
     * = 0; while (/* cycle.size() < cycleLength &&
     *//*
        * counter < cycleLength - 1 && unused.size() > 0) { extendCycle(); ++counter; }
        * System.out.println(cycle.size()); TSPSolution solution = new TSPSolution();
        * solution.setCycle(cycle); solution.setGraph(graph); System.out.println(cycleLengh()); return
        * solution; }
        * 
        * private void extendCycle() { int cycleExtensionCost = Integer.MAX_VALUE; int indexFrom = 0; int
        * indexTo = 0; for (Point pointFrom : cycle) { for (Point pointTo : unused) {
        * 
        * int distanceTo = graph.getDistance(pointFrom, pointTo); int distanceFrom =
        * graph.getDistance(pointTo, pointFrom.getNext()); if ((distanceTo + distanceFrom) <
        * cycleExtensionCost) { cycleExtensionCost = distanceTo + distanceFrom; indexFrom =
        * pointFrom.getNumber(); indexTo = pointTo.getNumber(); } } } Point pointFrom =
        * graph.getPoint(indexFrom); Point pointTo = graph.getPoint(indexTo);
        * 
        * pointTo.setNext(pointFrom.getNext()); pointFrom.setNext(pointTo);
        * 
        * cycle.add(cycle.indexOf(pointFrom) + 1, pointTo); unused.remove(pointTo); }
        * 
        * private int cycleLengh() { int totalCycleLength = 0; Point currentPoint =
        * graph.getPoint(startIndex); for (int i = 0; i < cycle.size() - 1; ++i) { totalCycleLength +=
        * graph.getDistance(currentPoint, currentPoint.getNext()); currentPoint = currentPoint.getNext();
        * System.out.println(totalCycleLength); }
        * 
        * return totalCycleLength; }
        */
}
